package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.SystemDictionary;
import cn.wolfcode.crm.mapper.SystemdictionaryMapper;
import cn.wolfcode.crm.qo.QueryObject;
import cn.wolfcode.crm.service.ISystemDictionaryService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemDictionaryServiceimpl implements ISystemDictionaryService {

    @Autowired
    private SystemdictionaryMapper systemdictionaryMapper;

    @Override
    public void save(SystemDictionary systemdictionary) {
        systemdictionaryMapper.insert(systemdictionary);
    }

    @Override
    public void deleteByPrimaryKey(Long id) {

        systemdictionaryMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void updateByPrimaryKey(SystemDictionary systemdictionary) {
        systemdictionaryMapper.updateByPrimaryKey(systemdictionary);
    }

    @Override
    public SystemDictionary get(Long id) {
        return systemdictionaryMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<SystemDictionary> selectAll() {
        return systemdictionaryMapper.selectAll();
    }

    @Override
    public PageInfo query(QueryObject qo) {

        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<SystemDictionary> list = systemdictionaryMapper.queryForList(qo);
        return new PageInfo(list);
    }
}
